//
// Created by 123 on 2025/1/6.
//
#include "iostream"
#include "string"
using namespace std;

template<class NameType,class AgeType=int>
class Person{
public:
    Person(NameType name,AgeType age){
        this->name = name;
        this->age = age;
    }
    void showPerson(){
        cout << "name:" << this->name << " age:" << this->age << endl;
    }
public:
    NameType name;
    AgeType age;
};

void test1(){
    //类模板没有自动类型推导的使用方式,新版有自动类型推导
    Person p1("zhangsna",999);
    Person<string ,int> p2("lisi",999);
    p1.showPerson();
    p2.showPerson();

    //类模板在模板参数列表中可以有默认参数
    Person<string> p3 ("wangwu",888);
    p3.showPerson();
}



int main101(){
    test1();

    return 0;
}